﻿using System;
using System.Collections;
using System.Collections.Generic;
using Huirui.Cavan.Domain.MainBoundedContext.StockModule;
using Huirui.Cavan.Domain.MainBoundedContext.SystemModule;
using Huirui.Cavan.Domain.Seedwork;

namespace Huirui.Cavan.Domain.MainBoundedContext.SalesModule
{
    #region Sale

    /// <summary>
    /// Sale object for NHibernate mapped table 'Sales'.
    /// </summary>
    [Serializable]
    public class Sale : Persistent<string>
    {
        #region Member Variables

        protected DateTime _salesDate;
        protected string _deliveryCode;
        protected string _deliveryAddress;
        protected string _customerOrderCode;
        protected string _checkCode;
        protected int _checkType;
        protected string _remark;
        protected decimal _discountRate;
        protected int _receiptType;
        protected int _receiptCondition;
        protected int _payDay;
        protected DateTime _deadDate;
        protected string _currency;
        protected decimal _currencyRate;
        protected decimal _taxRate;
        protected Corporation _corporation;
        protected Customer _customer;
        protected Employee _saleEmployee;
        protected Employee _receiptEmployee;
        protected Project _project;
        protected Receipt _receipt;
        protected WareHouse _wareHouse;
        protected SalesOrder _salesOrder;
        protected Account _receiptAccount;
        protected StockInOut _stockInOut;

        #endregion

        #region Constructors

        public Sale() { }

        public Sale(string id, DateTime salesDate, string deliveryCode, string deliveryAddress, string customerOrderCode, string checkCode, int checkType, 
            string remark, decimal discountRate, int receiptType, int receiptCondition, int payDay, DateTime deadDate, string currency, 
            decimal currencyRate, decimal taxRate, DateTime createDate, DateTime modifyDate, int editUser, Corporation corporation, Customer customer, Employee salesEmployee, 
            Project project, WareHouse wareHouse, Receipt receipt, SalesOrder salesOrder, Account receiptAccount, Employee receiptEmployee)
        {
            this.Id = id;
            this._salesDate = salesDate;
            this._deliveryCode = deliveryCode;
            this._deliveryAddress = deliveryAddress;
            this._customerOrderCode = customerOrderCode;
            this._checkCode = checkCode;
            this._checkType = checkType;
            this._remark = remark;
            this._discountRate = discountRate;
            this._receiptType = receiptType;
            this._receiptCondition = receiptCondition;
            this._receiptAccount = receiptAccount;
            this._receiptEmployee = receiptEmployee;
            this._payDay = payDay;
            this._deadDate = deadDate;
            this._createDate = createDate;
            this._modifyDate = modifyDate;
            this._editUser = editUser;
            this._corporation = corporation;
            this._customer = customer;
            this._saleEmployee = salesEmployee;
            this._project = project;
            this._receipt = receipt;
            this._salesOrder = salesOrder;
            this._currency = currency;
            this._currencyRate = currencyRate;
            this._wareHouse = wareHouse;
            this._taxRate = taxRate;
        }

        #endregion

        #region Public Properties


        public virtual DateTime SalesDate
        {
            get { return _salesDate; }
            set { _salesDate = value; }
        }

        public virtual string DeliveryCode
        {
            get { return _deliveryCode; }
            set
            {
                if (value != null && value.Length > 100)
                    throw new ArgumentOutOfRangeException("Invalid value for DeliveryCode", value, value.ToString());
                _deliveryCode = value;
            }
        }

        public virtual string DeliveryAddress
        {
            get { return _deliveryAddress; }
            set
            {
                if (value != null && value.Length > 200)
                    throw new ArgumentOutOfRangeException("Invalid value for DeliveryAddress", value, value.ToString());
                _deliveryAddress = value;
            }
        }

        public virtual string CustomerOrderCode
        {
            get { return _customerOrderCode; }
            set
            {
                if (value != null && value.Length > 100)
                    throw new ArgumentOutOfRangeException("Invalid value for CustomerOrderCode", value, value.ToString());
                _customerOrderCode = value;
            }
        }

        public virtual string CheckCode
        {
            get { return _checkCode; }
            set
            {
                if (value != null && value.Length > 100)
                    throw new ArgumentOutOfRangeException("Invalid value for CheckCode", value, value.ToString());
                _checkCode = value;
            }
        }

        public virtual int CheckType
        {
            get { return _checkType; }
            set { _checkType = value; }
        }

        public virtual string Remark
        {
            get { return _remark; }
            set
            {
                _remark = value;
            }
        }

        public virtual decimal DiscountRate
        {
            get { return _discountRate; }
            set { _discountRate = value; }
        }

        public virtual int ReceiptType
        {
            get { return _receiptType; }
            set { _receiptType = value; }
        }

        public virtual int ReceiptCondition
        {
            get { return _receiptCondition; }
            set { _receiptCondition = value; }
        }

        public virtual Account ReceiptAccount
        {
            get { return _receiptAccount; } 
            set
            {
                _receiptAccount = value;
            }
        }

        public virtual Employee ReceiptEmployee
        {
            get { return _receiptEmployee; }
            set
            {
                _receiptEmployee = value;
            }
        }

        public virtual int PayDay
        {
            get { return _payDay; }
            set { _payDay = value; }
        }

        public virtual DateTime DeadDate
        {
            get { return _deadDate; }
            set { _deadDate = value; }
        }

        public virtual string Currency
        {
            get { return _currency; }
            set
            {
                if (value != null && value.Length > 20)
                    throw new ArgumentOutOfRangeException("Invalid value for Currency", value, value.ToString());
                _currency = value;
            }
        }

        public virtual decimal CurrencyRate
        {
            get { return _currencyRate; }
            set { _currencyRate = value; }
        }

        public virtual decimal TaxRate
        {
            get { return _taxRate; }
            set { _taxRate = value; }
        }

        public virtual Corporation Corporation
        {
            get { return _corporation; }
            set { _corporation = value; }
        }

        public virtual Customer Customer
        {
            get { return _customer; }
            set { _customer = value; }
        }

        public virtual Employee SaleEmployee
        {
            get { return _saleEmployee; }
            set { _saleEmployee = value; }
        }

        public virtual Project Project
        {
            get { return _project; }
            set { _project = value; }
        }

        public virtual Receipt Receipt
        {
            get { return _receipt; }
            set { _receipt = value; }
        }

        public virtual SalesOrder SalesOrder
        {
            get { return _salesOrder; }
            set { _salesOrder = value; }
        }

        public virtual WareHouse WareHouse
        {
            get { return _wareHouse; }
            set { _wareHouse = value; }
        }

        public virtual StockInOut StockInOut
        {
            get { return _stockInOut; }
            set { _stockInOut = value; }
        }
        #endregion
    }
    #endregion
}